package thread.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class FutureTaskManager {
    private static FutureTaskManager manager = new FutureTaskManager();

    private FutureTaskManager() {}

    public FutureTaskManager getFutureTaskManger() {
        return manager;
    }

    public static <T> T run(FutureTask<T> task) throws ExecutionException, InterruptedException {
        new Thread(task).start();
        return task.get();
    }
}
